import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;


public class VendingMachineItemTest {
	VendingMachineItem VendingMachineItem1;
	
	@Before
	public void setUp() throws Exception {
		VendingMachineItem1=new VendingMachineItem("Donuts", 3.5);
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testVendingMachineItemConstructor(){
		assertEquals(this.VendingMachineItem1,VendingMachineItem1);
	}
	
	/**
	 * This method tests creating "VendingMachineItem" object with invalid price
	 * VendingMachineItem constructor must throw an exception
	 */
	@Test (expected = VendingMachineException.class)
	public void testVendingMachineItemConstructorExceptionP(){
		VendingMachineItem1=new VendingMachineItem("Donuts", -2);
	}
	
	/**
	 * This method tests getting the item's name
	 */
	@Test
	public void testGetName(){
		
		Assert.assertSame("Donuts", VendingMachineItem1.getName());
	}
	
	/**
	 * This method test getting the item's price
	 */
	@Test
	public void testGetPrice(){
		Assert.assertEquals(3.5, VendingMachineItem1.getPrice(), 0.0001);
	}
}
